var bStockWinAdd;
var bStockFormAdd;
function addBStock(){
	initBStockFormAdd();
	bStockWinAdd = Ext.create('Ext.Window',{
		layout:'fit',
		width:800,
		height:400,
		maximizable:true,
		minimizable:true,
		animateTarget:document.body,
		plain:true,
		modal:true,
		title:'添加信息',
		listeners:{
			minimize:function(win,opts){
				win.collapse();
			}
		},
		items:bStockFormAdd,
		buttons:[{
			text:'保存',
			itemId:'save',
			handler:function(button){
				submitForm(bStockFormAdd,'../bStockController/addBStock',grid,bStockWinAdd,false,true);
			}
		},{
			text:'关闭',
			itemId:'close',
			handler:function(button){
				button.up('window').close();
			}
		}]
	});
	bStockWinAdd.show();
}
function initBStockFormAdd(){
	bStockFormAdd = Ext.create('Ext.FormPanel',{
		xtype:'form',
		waitMsgTarget:true,
		defaultType:'textfield',
		fieldDefaults:{
			labelWidth:70,
			labelAlign:'right',
			flex:1,
			margin:'2 5 4 5'
		},
		items:[
		{
			fieldLabel:'商户、卖家产品编号',
			xtype:'textfield',
			hidden:true,
			name:'b_seller_product_id',
			id:'b_seller_product_id',
			maxLength:32,
			allowBlank:false,
			anchor:'100%'
		},
		{
			fieldLabel:'商户卖家',
			xtype:'textfield',
			name:'b_seller_name',
			id:'b_seller_name',
			maxLength:32,
			anchor:'60%',
			allowBlank:false,
			readOnly:true,
			listeners:{
				render:function(p){   
			     	p.getEl().on('click',function(p){   
			     		selectBSellerProduct();
				    });
			    }
			}
		},
		{
			fieldLabel:'商户产品',
			xtype:'textfield',
			name:'b_product_name',
			id:'b_product_name',
			maxLength:32,
			anchor:'60%',
			allowBlank:false,
			readOnly:true
		},
		{
			fieldLabel:'可卖数量',
			xtype:'numberfield',
			value:'0',
			name:'b_stock_countable_sell',
			anchor:'40%'
		},
		{
			fieldLabel:'已卖数量',
			xtype:'numberfield',
			value:'0',
			name:'b_stock_locks_number',
			anchor:'40%'
		}
		]
	});
}
